package com.ruoyi.logistic.service.impl;

import com.ruoyi.logistic.domain.HomeNavigationBar;
import com.ruoyi.logistic.mapper.HomeNavigationBarMapper;
import com.ruoyi.logistic.service.IHomeNavigationBarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HomeNavigationBarServiceImpl implements IHomeNavigationBarService {
    @Autowired
    private HomeNavigationBarMapper homeNavigationBarMapper;
    @Override
    public List<HomeNavigationBar> selectAll() {
        List<HomeNavigationBar> homeNavigationBars = homeNavigationBarMapper.selectAll();
        for (HomeNavigationBar homeNavigationBar:homeNavigationBars){
            List<HomeNavigationBar> homeNavigationBars1 = homeNavigationBarMapper.findTwoLevel(homeNavigationBar.getId());
            for (HomeNavigationBar homeNavigationBar2 : homeNavigationBars1){
                homeNavigationBar2.setHomeNavigationBars(homeNavigationBarMapper.findThreeLevel(homeNavigationBar2.getId()));
            }
            homeNavigationBar.setHomeNavigationBars(homeNavigationBars1);
        }
        return homeNavigationBars;
    }
}
